using System;
using System.Collections.Generic;
using System.Linq;
using Class.Web.Mvc;
using ThuySan.Bussiness;

namespace ThuySan.Repository
{
    public partial class TagRepository
    {
        public bool CheckInsertTag(Tag tag)
        {
            return true;
        }

        public bool CheckUpdateTag(Tag tag)
        {
            return true;
        }

        public bool CheckDeleteTag(IEnumerable<int> list)
        {
            return true;
        }

        public void Delete(IEnumerable<int> enumerable, string alias, Action<string, string, IImageContent> func)
        {
            List<Tag> tags = Select(c => enumerable.Contains(c.TagId)).ToList();
            foreach (Tag tag in tags)
            {
                if (!string.IsNullOrEmpty(tag.Avatar))
                {
                    func.Invoke(alias, tag.Avatar, tag);
                }
            }
            Delete(tags);
        }
    }
}
